package me.ezjs.framework.core.validator;

import me.ezjs.framework.core.model.DAOFilter;
import me.ezjs.framework.core.model.ParamTree;
import me.ezjs.framework.core.model.Parameter;

import java.util.Map;

/**
 * DAOFilter的校验
 * Created by zero-mac on 16/3/10.
 */
public class FilterValidator {

    public void validate(DAOFilter filter, Class<?> clazz) {
        //FIXME:暂时只校验前端数据
        if (filter.isAllowFrontParam()) {
            validateFrontParam(filter, clazz);
        }
    }

    private void validateSelect(DAOFilter filter) {
        filter.getSelect();//select字句
    }

    private void validateFrontParam(DAOFilter filter, Class<?> clazz) {
        Map<String, Parameter> s = filter.getS();//来自前端的查询参数
        //TODO
    }

    private void validateWhere(DAOFilter filter) {
        ParamTree paramTree = filter.getParamTree();//where字句

    }

    private void validateSort(DAOFilter filter) {
        filter.getSl();//order字句
    }


}
